#!/usr/bin/env python

import subprocess
import time

IP_LIST = [ 'www.baidu.com',
            'www.163.com',
            'www.sohu.com',
            'www.sina.com.cn']

cmd_stub = 'ping -c 5 {}'


def do_ping(addr):
    print(time.asctime(), "DOING PING FOR", addr)
    cmd = cmd_stub.format(addr)
    return subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)


for domain in IP_LIST:
    do_ping(domain)

